<script>
export default {
  name: 'typeForm',
  data() {
    return {
      formData: {
        name: '',
        remark: '',
        status: 1,
        defaultVolume: '',
        defaultWeight: ''
      }
    }
  },
  methods: {
    /*
    *
    * 货物货物类型详情
    *  */
    async fetchGoodsTypeDetail(id) {
      try {
        const detail = await this.$store.dispatch('goodsTypeStore/fetchGoodsTypeDetailAction', id)
        this.formData = detail
      } catch (error) {
        this.$message.error(error.message)
      }
    },
    /*
    * 清空表单数据
    *  */
    clearFormData() {
      this.formData = {
        name: '',
        remark: '',
        status: 1,
        defaultVolume: '',
        defaultWeight: ''
      }
    }
  }
}
</script>

<template>
  <el-form :model="formData" label-width="120px">
    <el-form-item label="货物类型名称">
      <el-input placeholder="请输入货物类型名称" v-model="formData.name"></el-input>
    </el-form-item>
    <el-form-item label="货物重量">
      <el-input placeholder="请输入货物重量" v-model="formData.defaultWeight"></el-input>
    </el-form-item>
    <el-form-item label="货物体积">
      <el-input placeholder="请输入货物体积" v-model="formData.defaultVolume"></el-input>
    </el-form-item>
    <el-form-item label="货物类型说明">
      <el-input type="textarea" :rows="3" placeholder="请输入货物类型说明" v-model="formData.remark"></el-input>
    </el-form-item>
    <el-form-item label="货物类型状态">
      <el-switch v-model="formData.status" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0">
      </el-switch>
    </el-form-item>
  </el-form>
</template>

<style scoped lang="scss">
.el-form {
  width: 80%;
}
</style>
